package com.briup.sms.web.controller;

import com.briup.sms.service.DashboardService;
import com.briup.sms.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author :xuyang
 * @DateTime:2024/1/11 16:57
 * @Version :v1.0.0
 * ClassName:DashboardController
 * Package  :com.briup.sms.web.controller
 * Description:TODO
 */
@RestController
@RequestMapping("/index")
@Api(tags = "首页管理")
@CrossOrigin
public class DashboardController {
    @Autowired
    DashboardService service;

    @GetMapping("/dashboard")
    @ApiOperation("首页仪表盘数据")
    public Result dashborad() {
        Map map = service.map();
        return Result.success(map);
    }

    @GetMapping("/sexRatio")
    @ApiOperation("会员性别比例")
    public Result sexRatio() {
        Map map = service.sexRatio();
        return Result.success(map);
    }

    @GetMapping("/categoryStats")
    @ApiOperation("商品分类统计")
    public Result categoryStats() {
        Map map = service.categoryStats();
        return Result.success(map);
    }
}

